//验证规则
//导入定义验证规则
const joi = require('joi')
    // 用户名的验证规则
const username = joi.string().alphanum().min(3).max(10).required()
    // 密码的验证规则
const password = joi.string().pattern(/^[\S]{6,12}$/).required()
const email = joi.string().email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } })
const mobile = joi.string().pattern(/^1[3-9]\d{9}$/)
    // 登录表单的验证规则对象
exports.login_schame = {
    body: {
        username,
        password,
    }
}
exports.user_create_schema = {
    body: {

        username,
        password,
        email,
        mobile
    }
}
exports.user_update_schema = {
    body: {
        email,
        mobile
    }
}